package com.aabte.design2.creational.prototype;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * @author Daniel
 * @version 1.0
 * @date 2020/5/3
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Accessors(chain = true)
public class Rectangle extends Shape {
    private int width;
    private int height;

    public Rectangle() {
    }

    public Rectangle(Rectangle rectangle) {
        // 需要调用父构造函数来复制父类中定义的私有成员变量
        super(rectangle);
        this.width = rectangle.width;
        this.height = rectangle.height;
    }

    @Override
    public Rectangle clone() {
        return new Rectangle(this);
    }
}
